# This file is modified from the original AdrienRemembers me version
# The group attribute has been added to the Member class.
# Initial branch from Adrien Remembers Me App.  


from google.appengine.ext import db
from google.appengine.api import images

#DB Models
class Member(db.Model):
    name = db.StringProperty()
    salt = db.StringProperty()
    password = db.StringProperty()
    fullname = db.StringProperty()
    email = db.StringProperty()
    emailisvalid = db.BooleanProperty()
    emailvalidationcode = db.StringProperty()
    timeadded = db.DateTimeProperty(auto_now_add=True)
    group = db.StringProperty(required=True,
            default="guest",
            choices=set(["guest","scout","parent","admin","dev"]))
    
class LoginRecord(db.Model):
    code = db.StringProperty()
    member = db.ReferenceProperty(Member)
    timeadded = db.DateTimeProperty(auto_now_add=True)
    browser = db.StringProperty()
    ip = db.StringProperty()

class Photo(db.Model):
    member = db.ReferenceProperty(Member)
    filename = db.StringProperty()
    content = db.BlobProperty()
    thumb = db.BlobProperty()
    timeadded = db.DateTimeProperty(auto_now_add=True)
    
class PasswordResetLink(db.Model):
    member = db.ReferenceProperty(Member)
    code = db.StringProperty()
    alreadyused = db.BooleanProperty()
    timeadded = db.DateTimeProperty(auto_now_add=True)

#End of DB Models
